import * as events from './events'
import axios from 'axios'

export const testAction = (context) => {
  console.log(axios)
  context.commit(events.TEST_EVENT, 'test')
}
export const getUserInfo = (context) => {
  let r = parseInt(100000 * Math.random())
  return new Promise((resolve, reject) => {
    axios.get('/member/info', {
      params: {
        r
      }
    }).then((data) => {
      resolve(data)
      if (data.data.httpCode === 200) {
        if (data.data.data.memberGrade) {
        }
        context.commit(events.CHANGE_USER_INFO, data.data.data)
      } else {
      }
    }).catch((err) => {
      console.log(err)
      reject(err)
    })
  })
}
